#include <cassert>
#include <string>

using namespace std;

class Solution {
public:
    bool isSubsequence(string s, string t) {
        int sLen = s.size();
        if (sLen == 0) {
            return true;
        }

        int tLen = t.size();
        for (int i = 0, j = 0; j < tLen; ++j) {
            if (s[i] == t[j]) {
                ++i;
                if (i == sLen) {
                    return true;
                }
            }
        }

        return false;
    }
};

int main() {
    Solution s;

    string s1 = "abc", t1 = "ahbgdc";
    string s2 = "axc", t2 = "ahbgdc";

    assert(s.isSubsequence(s1, t1) == true);
    assert(s.isSubsequence(s2, t2) == false);

    return 0;
}